#include <iostream>
using namespace std;

const int kMaxV = 5e7 + 10;
const int kMaxN = 3e6 + 10;

bool not_pri[kMaxV];
int pri[kMaxN], tot = 0;

void GetPrimeList(int n) {
  for (int i = 2; i < kMaxV && tot < n; i++) {
    if (not_pri[i] == false) {
      pri[tot++] = i;
      not_pri[i] = true;
    }
    for (int j = 0; j < tot && i * pri[j] < kMaxV; j++) {
      not_pri[i * pri[j]] = true;
      if (i % pri[j] == 0) {
        break;
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;

  cin >> n;
  GetPrimeList(n);
  cout << pri[n - 1] << "\n";
  return 0;
}